#include <math.h>

#ifndef d_Vec2f_H
#define d_Vec2f_H

namespace d_Math
{
	class d_Vec2f
	{
	public:
		float p[2];
	
		d_Vec2f();
		d_Vec2f(float x, float y);
		float &operator [] (int index) {return p[index];}
		/*d_Vec2f& operator = (d_Vec2f& a) 
		{
			p[0] = a.p[0];
			p[1] = a.p[1];
			return *this;
		}
		d_Vec2f& operator = (int x, int y) 
		{
			p[0] = x;
			p[1] = y;
			return *this;
		}*/

		d_Vec2f operator + (d_Vec2f a) {return d_Vec2f(p[0]+a[0], p[1]+a[1]);}
		d_Vec2f operator - (d_Vec2f a) {return d_Vec2f(p[0]-a[0], p[1]-a[1]);}
		d_Vec2f operator * (float a) {return d_Vec2f(p[0]*a, p[1]*a);}
		d_Vec2f operator / (float a) {return d_Vec2f(p[0]*a, p[1]*a);}

		float length() { return sqrt(p[0]*p[0]+p[1]*p[1]); }
		void normalize() { *this/length(); }
	};

	d_Vec2f norm(d_Vec2f a);
	float dot(d_Vec2f a, d_Vec2f b);
}

#endif //d_Vec2f_H
